package com.baofu.paycore.biz.thread;

import com.system.dispatch.CmdManager;
import com.system.dispatch.dal.model.BizCmdDO;
import lombok.extern.slf4j.Slf4j;

/**
 * 插入dispatch指令线程
 *
 * <p>
 *  1.执行插入
 * </p>
 * User: xin deng  Date: 16/7/6 ProjectName: paycore Version: 1.0
 */
@Slf4j
public class BizCmdAddThread implements Runnable {

    /**
     * dispatch 命令
     */
    private BizCmdDO bizCmdDO;

    /**
     * 命令Manager
     */
    private CmdManager cmdManager;

    /**
     * 创建dispatch线程
     *
     * @param bizCmdDO      dispatch指令对象
     * @param cmdManager    manager
     */
    public BizCmdAddThread(BizCmdDO bizCmdDO, CmdManager cmdManager){
        this.bizCmdDO = bizCmdDO;
        this.cmdManager = cmdManager;
    }

    /**
     * 执行插入
     */
    @Override
    public void run() {

        try{
            cmdManager.insert(bizCmdDO);

        }catch (Exception e){
            log.error("插入dispatch异常:{}", e);
        }
    }
}
